package cn.jtfadmin.core.modules.base.region.domain.entity;


import cn.jtfadmin.base.data.jpa.domain.entity.BaseEntity;
import cn.jtfadmin.base.lang.common.domain.entity.NamedTreeEntity;
import cn.jtfadmin.core.modules.base.region.enums.RegionTypeEnum;
import lombok.Data;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Entity
@Table(name = "base_region")
@Data
public class BaseRegionEntity extends BaseEntity implements NamedTreeEntity {


    /**
     * 行政区域编码
     */
    @NotBlank
    @Size(max = 10)
    @Column(name = "no", unique = true, length = 10)
    protected String no;

    /**
     * 行政区域名称
     */
    @NotBlank
    @Size(max = 100)
    @Column(name = "name", length = 100)
    protected String name;

    /**
     * 上级id
     */
    @Column(name = "parent_id")
    protected String parentId;

    /**
     * 上级ids
     */
    @Column(name = "parent_ids")
    @Lob
    protected String parentIds;

    /**
     * 排序
     */
    @Column(name = "sort")
    protected Integer sort;


    /**
     * 类型
     */
    @NotNull
    @Column(name = "type", length = 100)
    @Enumerated(EnumType.STRING)
    protected RegionTypeEnum type;

    /**
     * 区域边界经纬度
     */
    @Column(name = "position")
    @Lob
    protected String position;




}
